<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
echo "<h2>Пользователи</h2>";
$this->table->set_heading('id', 'e-mail', 'Имя', 'Группа', 'Действия');
$tmpl = array('table_open' => '<table border="0" cellpadding="0" cellspacing="0" class="admin_table">');
$this->table->set_template($tmpl);

$class = 'users';
if ($this->users_rights_model->check_rights($class, 'block', true)) $canblock = 1;
if ($this->users_rights_model->check_rights($class, 'unblock', true)) $canblock = 1;
if ($this->users_rights_model->check_rights($class, 'edit', true)) $canedit = 1;
if ($this->users_rights_model->check_rights($class, 'delete', true)) $candelete = 1;
if ($this->users_rights_model->check_rights($class, 'add', true)) $canadd = 1;

foreach ($pages as $page) {
	$this->table->add_row(
			$page['id'],
			"<a href='/admin/users/edit/".$page['id']."/'>".$page['email']."</a>",
			$page['first_name']." ".$page['last_name'],
			$groups[$page['group_id']]['description'],
			showmeactions(
					'users',
					$page['id'],
					$page['active'],
					$canedit, $candelete, $canblock,
					$from
				)
		);
}
echo $this->table->generate();
echo $paging;
if ($canadd == 1) {
	echo showmeadd('users', 'Добавить пользователя');
}
echo "<div class='cc'></div>";
?>
